<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>

<body>
	<div>
	    <!-- <span>{$user.user_name}</span> -->
		{if condition="$user eq null"} <input type="button"
			onclick="show('loginPage')" id="login" value="登录" /> 
		{else /} <input type="button" onclick="quit()" id="quit" value="退出" />
		         &nbsp;&nbsp;用户名:<span>{$user.user_name}</span>
		{/if}
		&nbsp;&nbsp;<input type="button" onclick="show('post')" value="发帖">
	</div>
	<div>
		<table border="1" style="border-collapse: collapse;">
			<tr>
				<th>id</th>
				<th>title</th>
				<th>user_id</th>
				<th>create_time</th>
			</tr>
			{volist name='list' id='post'}
			<tr>
				<td>{$post.id}</td>
				<td><a href="{:url('/index/index/postdetail')}?id={$post.id}">{$post.title}</a></td>
				<td>{$post.user_id}</td>
				<td>{$post.create_time}</td>
			</tr>
			{/volist}
		</table>
	</div>
	{$list->render()}
	<div id="loginPage" style="display:none">
		用户:<input type="text" name="user_name" id="user_name" placeholder="user_name" /><br />  
		密码:<input type="password" name="user_password" id="user_password" placeholder="user_password" /><br />
		     <input type="button" onclick="login()" value="登录" /><input type="button" onclick="state()" value="注册">
	</div>
	
	<div id="regist" style="display:none">
		用户:<input type="text" name="user_name" id="registuser_name" placeholder="user_name" /><br /> 
		密码:<input type="password" name="user_password" id="registuser_password" placeholder="user_password" /><br />
		     <input type="button" onclick="regist()" value="确认" />
	</div>
	
	<div id="post" style="display:none">
		        <input type="hidden" name="user_id" id="user_id" value="{$user.id}" /><br /> 
		        <input type="hidden" name="create_time" id="create_time"
			      value="{:date('Y-m-d H:i:s',time())}" /><br />
		       标题:<input type="text" name="title" id="title" value="" /><br /> 
		       内容:<input type="text" name="content" id="content" value="" /><br />     
			    <input type="button" onclick="post()" name="complete" value="完成" /><br />
	</div>
<script src="/js/postlist.js"></script>
<div id="reply"></div>
</body>
</html>